package com.asset.controller;

import com.asset.model.vo.AssetCategoryVO;
import com.asset.service.AssetCategoryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/asset/categories")
public class AssetCategoryController {

    @Resource
    private AssetCategoryService assetCategoryService;

    /**
     * 获取资产类别树形结构
     * @return 根节点列表
     */
    @GetMapping("/tree")
    public List<AssetCategoryVO> getCategoryTree() {
        return assetCategoryService.buildCategoryTree();
    }
}